<?php
session_start();
include '../conn.php';
include 'function.php';

$uid=$_REQUEST['uid'];

$sql = "SELECT * FROM user where id = '".$uid."'";
$result = $conn->query($sql);

if ($result->num_rows <= 0) {

echo '请先注册或登录！';
exit;
  }

?>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>在线商城</title>
  <link rel="stylesheet" type="text/css" href="../css/general.css">
  <link rel="stylesheet" type="text/css" href="../css/index.css">
  <script type="text/javascript" src="../js/jquery.js"></script>
  <script type="text/javascript" src="../js/general.js"></script>
  <script type="text/javascript" src="../js/carousel.js"></script>
</head>
<body>
<!-- 顶部开始 -->

<!-- 头部开始 -->
<?php include '../header.php'; ?>
<!-- 头部结束 -->
<!-- 主体开始 -->
<div class="container w1100">
  <p style="font-size:30px">我的购物车</p>
      <hr><br>
      <p >
        <?php
$sql = "SELECT * FROM cart where user_id = ".$uid;
$result = $conn->query($sql);

if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<a href='../goods.php?id=<?php echo $row['goods_id']?>&uid=<?php echo $uid?>'>

<?php
  echo "<br><p style='font-size:2em'>商品名称:".getGoodsNameById($conn,$row['goods_id'])."</p></a>
  <p style='font-size:2em'>数量:".$row['count']."</p>";
 ?>
<p style='font-size:30px'><a href="/user/payall.php?uid=<?php echo $uid?>&gid=<?php echo $row['goods_id']?>&count=<?php echo $row['count']?>">付款</a></p>
<hr>
 <?php
 
}
}
 ?> </p>
 <p style='font-size:30px'><a href="/user/cleancart.php?uid=<?php echo $uid?>">清空购物车</a></p>

</div>
<!-- 页脚开始 -->
<div class="footer mt20">
<script type="text/javascript" src="../js/juicer.js"></script>
</body></html>
